<!DOCTYPE html>
<html>

<head>
<title>WebGL testing</title>
<meta charset="UTF-8">
<script type="text/javascript" src="../../build/js/Cindy.js"></script>
<script type="text/javascript" src="../../build/js/Cindy3D.js"></script>
<script id="csinit" type="text/x-cindyscript">use("Cindy3D")</script>
<script id="csdraw" type="text/x-cindyscript">
m = 50;
n = 20;
r1 = 1;
r2 = 0.3;
begin3d();
mesh3d(m+1, n+1, flatten(apply(0..m, i, apply(0..n, j, (
  a = i/m*360°;
  b = j/n*360°;
  p = [cos(a), sin(a), 0];
  q = cos(b)*[0,0,1] + sin(b)*p;
  r1*p + r2*q
)))), flatten(apply(0..m, i, apply(0..n, j, (
  a = i/m*360°;
  b = j/n*360°;
  p = [cos(a), sin(a), 0];
  cos(b)*[0,0,1] + sin(b)*p
)))), uv->flatten(apply(0..m, i, apply(0..n, j, (
  a = 2*i/m;
  b = 2*j/n;
  2/512*(1,1) + 508/512*(min(a, 2-a), min(b, 2-b))
)))), normaltype->"perVertex", texture->"tex1");
end3d();
</script>
<script type="text/javascript">
CindyJS({canvasname:"CSCanvas",scripts:"cs*",images:{tex1:"tex1.png"}});
</script>
</head>

<body>
  <canvas id="Cindy3D" style="border: none;" width="632" height="452"></canvas>
  <div id="CSCanvas" style="width:50px; height:50px; border:none"></div>
</body>

</html>
